home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #306 (1994)(Rhein-Sieg-Soft).zip / Franz PD Disk #306 (1994)(Rhein-Sieg-Soft).adf / mand2000 / arexx / Demo.mnd2 < prev    next >
Text File  |  1993-11-07  |  8KB  |  221 lines

  1. /* This script is supplied with the Mand2000 demo and release */
  2. /* versions and may be freely distributed. */
  3. /* Copyright 1993 Cygnus Software. */
  4.  
  5. /* An ARexx script for imitating the Demo Mode of the earlier */
  6. /* versions of Mand2000.  This script zooms in (with pauses for */
  7. /* calculations) towards various beautiful locations specified */
  8. /* in the script.  When it reaches them it resets and zooms towards */
  9. /* another location. */
  10.  
  11.  
  12. portname = address()    /* Retrieve the current port name. */
  13. /* If the portname does not start with MAND2000 then this script must */
  14. /* have been run with rx, rather than from Mand2000.  Therefore we */
  15. /* need to set the port name.  We do not always set the port name */
  16. /* because it is better to let Mand2000 set it for us, so that */
  17. /* this script can be used with windows other than the one with */
  18. /* port name MAND2000.1. */
  19. if (left(portname, 8) ~= "MAND2000") THEN
  20.     address 'MAND2000.1'
  21.  
  22. options results
  23.  
  24. /*
  25.     The  following code sets up the coordinates of the pictures to
  26. zoom  towards  when  running  the  demo.   The format should be fairly
  27. obvious  from  the  examples below.  IMPORTANT:  before adding any new
  28. locations, or making any other changes to this file, be sure to make a
  29. backup  copy, as it is very easy to make syntax errors which will make
  30. this script stop working.
  31.  
  32.     The  name  of  the location must be enclosed in quotes.  The X
  33. and  Y  coordinates  are  the coordinates of the center of the spot to
  34. zoom  towards.   Zooms  is the number of zooms to do before going onto
  35. the  next  picture.   Type  is the fractal type.  Usually this will be
  36. 'Mandelbrot'  or  'Mandelbrot  Julia'.   If you specify Julia then you
  37. should also specify JuliaReal and JuliaImaginary (see Julia Boot as an
  38. example)  as  these  specify the Julia's seed location.  If you have a
  39. math  coprocessor  (68881,  68882  or  68040)  then  you also have the
  40. MandCubed  and  MandFourth  fractal  types, and their associated julia
  41. sets - see the help on set location for details.
  42.  
  43.     It  is very important when entering new numbers to ensure that
  44. your  numbers  are  correct - no spaces or commas allowed in numbers -
  45. and  that  the index number is the same for all the lines describing a
  46. particular location.  The index number is the number immediately after
  47. 'Pictures'.  It is also very important to enclose the location numbers
  48. in quotes, as in the examples below.  If you don't then ARexx will try
  49. to  interpret  the  numbers.   Usually  this  is okay, but many of the
  50. numbers  have more digits of accuracy than ARexx can handle, and these
  51. extra digits will get lost without the quoting.
  52.  
  53.     Because  the  demo  code  jumps  through the list in numerical
  54. order  (not  necessarily  in  the order they are defined in the file -
  55. although  right now that is the same thing) it is important that there
  56. be  no  gaps  in  the  list.   For  instance,  it  must go Pictures.0,
  57. Pictures.1,  Pictures.2,  etc.   It  is  also important that the final
  58. entry  have  a  zoom  count  of  zero so that the code will no when to
  59. return to the first entry.
  60.  
  61.     Forgetting to adjust the index number of the terminating entry
  62. is  the  single  most common error when adding entries to this script.
  63. Its  index number MUST be one larger than the index number of the last
  64. entry.
  65.  
  66.     Currently  this  script  is set up so that if you run it, then
  67. stop,  then  run  it  again,  it  will  resume on the same picture you
  68. stopped  on  (although  not  the  same zoom level).  If this behaviour
  69. causes  problems, or if this script encounters an error and ends up in
  70. an  undefined  state,  comment  out  the  line  below  which  says 'if
  71. (DemoPictureNum   =  "")  THEN'  by  enclosing  it  in  ARexx  comment
  72. delimiters,  like  this '/* if (DemoPictureNum = "") */'.  Do not type
  73. the  quotes.   The  line  is  clearly  marked and is shortly after the
  74. StartDemo:  label.
  75.  
  76.     If you run this script several times in a row without stopping
  77. it,  you  will  end  up with multiple 'Stop Demo' entries in your user
  78. menu.   These can be removed by repeatedly selecting 'Stop Demo' until
  79. they are all gone.
  80.  
  81.     If  for  some  reason  you  can  not  get  this script to stop
  82. running,  you  may  need to exit Mand2000.  This should only happen if
  83. there is a bug in the ARexx script.
  84.  
  85.     For  more  information,  consult  your  ARexx  manual  or  the
  86. Mand2000 ARexx documentation.
  87.     */
  88.  
  89. Pictures.0.Name = "Twelve arms"
  90. Pictures.0.X = "-.7764"
  91. Pictures.0.Y = "0.1346"
  92. Pictures.0.Zooms = 12
  93. Pictures.0.Type = "Mandelbrot"
  94.  
  95. Pictures.1.Name = "Dragon"
  96. Pictures.1.X = "-1.25269"
  97. Pictures.1.Y = "-0.04164"
  98. Pictures.1.Zooms = 12
  99. Pictures.1.Type = "Mandelbrot"
  100.  
  101. Pictures.2.Name = "Off axis filaments"
  102. Pictures.2.X = "-1.74910040"
  103. Pictures.2.Y = "-0.00034817"
  104. Pictures.2.Zooms = 25
  105. Pictures.2.Type = "Mandelbrot"
  106.  
  107. Pictures.3.Name = "Six arms"
  108. Pictures.3.X = "-.8627"
  109. Pictures.3.Y = "0.2648"
  110. Pictures.3.Zooms = 10
  111. Pictures.3.Type = "Mandelbrot"
  112.  
  113. Pictures.4.Name = "Julia Boot"
  114. Pictures.4.X = "0"
  115. Pictures.4.Y = "0"
  116. Pictures.4.JuliaReal = "0.329"
  117. Pictures.4.JuliaImaginary = "0.041"
  118. Pictures.4.Zooms = 4
  119. Pictures.4.Type = "Mandelbrot JULIA"
  120.  
  121. Pictures.5.Name = "Nautilus"
  122. Pictures.5.X = "-1.98540769643288"
  123. Pictures.5.Y =  "0.00000000000470"
  124. Pictures.5.Zooms = 38
  125. Pictures.5.Type = "Mandelbrot"
  126.  
  127. Pictures.6.Name = "Paisley"
  128. Pictures.6.X = "0.306594"
  129. Pictures.6.Y = "0.023627"
  130. Pictures.6.Zooms = 10
  131. Pictures.6.Type = "Mandelbrot"
  132.  
  133. Pictures.7.Name = "Russian circles"
  134. Pictures.7.X = "-1.98540769644835784"
  135. Pictures.7.Y =  "0.0"
  136. Pictures.7.Zooms = 50
  137. Pictures.7.Type = "Mandelbrot"
  138.  
  139.  
  140.  
  141. Pictures.8.Zooms = 0    /* This marks the end of the list. */
  142.  
  143.  
  144.  
  145. /* Parse out the command option.  This script is called when the */
  146. /* user wants demo mode started, when the user wants demo mode terminated */
  147. /* and whenever one of the demo frames is finished. */
  148.  
  149. parse arg command
  150.  
  151. command = upper(command)    /* Make sure the command is in upper case. */
  152.  
  153. if (command = START) then
  154.     CALL StartDemo()
  155. else if (command = STOP) then
  156.     CALL StopDemo()
  157. else
  158.     CALL ContinueDemo()
  159.  
  160. Exit
  161.  
  162.  
  163.  
  164. StartDemo:
  165.     DemoPictureNum = GETCLIP("DemoPictureNum")
  166.     /* Comment out the following line if you want this script to always */
  167.     /* restart at frame zero when you rerun it. */
  168.     if (DemoPictureNum = "") THEN
  169.         DO
  170.         DemoPictureNum = 0
  171.         CALL SETCLIP("DemoPictureNum", DemoPictureNum)
  172.         END
  173.     CALL NewLocation()
  174.     EVENTACTION PICTUREDONE Demo
  175.  
  176.     /* Put a command in the user menu for stopping the movie creation. */
  177.     menu '"------------------------"'
  178.     menu '"Stop Demo"' Demo stop
  179.     RETURN 0
  180.  
  181.  
  182.  
  183. StopDemo:
  184.     /* Tell Mand2000 not to call this script any more. */
  185.     EVENTACTION PICTUREDONE
  186.     /* Remove the `stop iter movie' menu. */
  187.     CLEARNMENUS 2
  188.     DISPLAYMESSAGE off
  189.     RETURN 0
  190.  
  191.  
  192.  
  193. ContinueDemo:
  194.     DemoPictureNum = GETCLIP("DemoPictureNum")
  195.     GETATTR stem PROJ
  196.     if (PROJ.NumZooms >= Pictures.DemoPictureNum.Zooms) THEN DO
  197.         DemoPictureNum = DemoPictureNum + 1
  198.         if (Pictures.DemoPictureNum.Zooms = 0) THEN    /* End of list */
  199.             DemoPictureNum = 0
  200.         CALL SETCLIP("DemoPictureNum", DemoPictureNum)
  201.         CALL NewLocation()
  202.         RETURN 0
  203.         END
  204.     ZoomInToFloat Pictures.DemoPictureNum.X Pictures.DemoPictureNum.Y
  205.     RETURN 0
  206.  
  207.  
  208.  
  209. NewLocation:
  210.     RESET
  211.     SETFRACTALTYPE Pictures.DemoPictureNum.Type
  212.     if (Pictures.DemoPictureNum.JuliaReal ~= "") THEN
  213.         SETJULIA Pictures.DemoPictureNum.JuliaReal Pictures.DemoPictureNum.JuliaImaginary
  214.     /* Remove the comments on the following line if you want the pictures */
  215.     /* name printed to the CLI when a new pictures starts calculating. */
  216.     /* say Pictures.DemoPictureNum.Name*/
  217.  
  218.     /* Comment out the following line if you don't want the status window. */
  219.     DisplayMessage 0 0 prompt "Calculating:" Pictures.DemoPictureNum.Name
  220.     RETURN 0
  221.